package com.javastudy.data;

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @use 一个简单的Java Bean
 * @author Bird
 *
 */
public class Person {
    public String name;
    private String sex;
    private String password;
    public  int age;
    public Date birthday;
    public String[] addresses = {"","",""};
    public List<String> children;
    public Map<String,String> bookMap;
    private Book book;

    public Person(){
      bookMap = new HashMap<String,String>();
    }
    
    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public  int getAge() {
        return age;
    }

    public  void setAge(int age) {
        this.age = age;
    }

    public String[] getAddresses() {
        return addresses;
    }
    
    //BeanUtils.setProperty需要这个方法
    public void setAddresses(int index,String addr){
      this.addresses[index] = addr;
      }

    public void setAddresses(String[] addresses) {
        this.addresses = addresses;
    }

    public List<String> getChildren() {
        return children;
    }

    public void setChildren(List<String> children) {
        this.children = children;
    }



    public Map<String, String> getBookMap() {
      return bookMap;
    }

    public void setBookMap(Map<String, String> bookMap) {
      this.bookMap = bookMap;
    }
    
    public void setBookMap(String key, String value) {
      this.bookMap.put(key, value);
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    @Override
    public String toString() {
      return "Person [name=" + name + ", sex=" + sex + ", password=" + password + ", age=" + age + ", birthday=" + birthday + ", addresses="
          + Arrays.toString(addresses) + ", children=" + children + ", books=" + bookMap + ", book=" + book + "]";
    }


}
